package com.cxy;

public class Facade {

    private Light light;
    private Tv tv;
    private AirCondition airCondition;

    public Facade(){
        light = new Light();
        tv = new Tv();
        airCondition = new AirCondition();
    }

    public void sayMessage(String message){
        if (message.contains("open")){
            open();
        } else if (message.contains("off")){
            off();
        } else{
            System.out.println("没有听到哦");
        }
    }

    public void open(){
        light.open();
        tv.open();
        airCondition.open();
    }

    public void off(){
        light.off();
        tv.off();
        airCondition.off();
    }

}
